'''
阻塞和非阻塞进程对比
进程池
'''
from  multiprocessing import Process,Pool,Queue
import time
import os

def task(name):
    time.sleep(1)
    print('进程id:{},name={}'.format(os.getpid(),name))
    pass


if __name__ == '__main__':
    p=Pool(5)
    for i in range(10):
        p.apply_async(task,args=(i,))# 非阻塞
        # p.apply(task,args=(1,)) # 阻塞式
    p.close()
    p.join()
    print('main process 结束！')
    
